package com.entity;

import java.util.*;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ReceiveAddress entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "receive_address", catalog = "dangdang")
public class ReceiveAddress implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Integer userId;
	private String receiveName;
	private String fullAddress;
	private String postalCode;
	private String mobile;
	private String phone;
	private List<DangOrder> dangOrders = new ArrayList<DangOrder>(0);

	// Constructors

	/** default constructor */
	public ReceiveAddress() {
	}

	/** minimal constructor */
	public ReceiveAddress(Integer userId, String receiveName,
			String fullAddress, String postalCode) {
		this.userId = userId;
		this.receiveName = receiveName;
		this.fullAddress = fullAddress;
		this.postalCode = postalCode;
	}

	/** full constructor */
	public ReceiveAddress(Integer userId, String receiveName,
			String fullAddress, String postalCode, String mobile, String phone,
			List<DangOrder> dangOrders) {
		this.userId = userId;
		this.receiveName = receiveName;
		this.fullAddress = fullAddress;
		this.postalCode = postalCode;
		this.mobile = mobile;
		this.phone = phone;
		this.dangOrders = dangOrders;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "user_id", nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "receive_name", nullable = false, length = 20)
	public String getReceiveName() {
		return this.receiveName;
	}

	public void setReceiveName(String receiveName) {
		this.receiveName = receiveName;
	}

	@Column(name = "full_address", nullable = false, length = 200)
	public String getFullAddress() {
		return this.fullAddress;
	}

	public void setFullAddress(String fullAddress) {
		this.fullAddress = fullAddress;
	}

	@Column(name = "postal_code", nullable = false, length = 8)
	public String getPostalCode() {
		return this.postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	@Column(name = "mobile", length = 15)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "phone", length = 20)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "receiveAddress")
	public List<DangOrder> getDangOrders() {
		return this.dangOrders;
	}

	public void setDangOrders(List<DangOrder> dangOrders) {
		this.dangOrders = dangOrders;
	}

}